const { merge } = require("webpack-merge");
const baseWebpackConfig = require("./webpack.base.conf");
const webpack = require("webpack");

const devWebpackConfig = merge(baseWebpackConfig, {
  // 这里是开发模式对应的配置
  mode: "development",
  // ...
  plugins: [
    // 注册全局环境变量
    new webpack.DefinePlugin({
      // 开发环境下的接口地址
      // 变量后面的值，是一段代码片段
      // "1.0.0" => 1.0.0
      API_BASE_URL: JSON.stringify("http://apidev.example.com"),
    }),
  ],
});

module.exports = devWebpackConfig;
